﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Entity.PagedList<WebManageRoles>>" %>
<%@ import Namespace="Common.Background.Entity" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    职位设置
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        <%=Html.ActionLink("职位设置", "WebManageRolesList", "System")%>-职位列表</h1>
    <%using (Html.BeginForm())
      { %>
    <table width="100%" cellspacing="1" cellpadding="3" class="chaxun_table">
        <tr>
            <td>
                <label for="RoleName">
                    职位名称</label><input name="RoleName" value="<%=Html.AttributeEncode(Request["RoleName"]) %>" />
                <% =Html.DropDownList("ManageRoleID", ViewData["droplist"] as SelectList) %>
                <button type="submit" class="button">
                    查询</button>
                <% =Html.ActionLink("添加职位", "WebManageRoles", null, new { @class = "AddWebManageRoles" })%>
            </td>
        </tr>
    </table>
    <%} %>
    <%Html.RenderPartial("UCWebManageRolesList", Model); %>
    <div id="Modal">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
    <link href="http://img1.c2cedu.com/image/Backstage/style/main.css" rel="stylesheet"
        type="text/css" />
    <link href="http://img1.c2cedu.com/image/myc2cedu/css/banntt.css" rel="Stylesheet"
        type="text/css" />
    <script src="../../Scripts/liebiao_table.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(window.document).ready(function () {

            var modal = $("#Modal").dialog({ autoOpen: false, width: 600, modal: true, title: "职位信息" });
            $(".AddWebManageRoles,.EditWebManageRoles").live("click", function (e) {

                return;

                var options = { url: this.href, sender: this };
                modal.load(options.url, function (e) {
                    modal.dialog("open");
                    var frm = modal.find("form");
                    frm.validate({
                        rules: {
                            RoleName: {
                                required: true,
                                minlength: 2,
                                maxlength: 50
                            },
                            DepartmentID: {
                                required: true
                            },
                            About: {
                                required: true,
                                minlength: 2,
                                maxlength: 50
                            },
                            SortNumber: {
                                required: true,
                                number: true
                            },
                            ManageRolesWebManage: {
                                required: true
                            }
                        },
                        messages: {
                            RoleName: {
                                required: "请输入角色名称",
                                minlength: "角色名称至少为2个字符，最多为50个字符",
                                maxlength: "角色名称至少为2个字符，最多为50个字符"
                            },
                            DepartmentID: {
                                required: "必须选择部门"
                            },
                            About: {
                                required: "请输入职位信息",
                                minlength: "职位信息至少为2个字符，最多为50个字符",
                                maxlength: "职位信息至少为2个字符，最多为50个字符"
                            },
                            SortNumber: {
                                required: "必须输入排序数",
                                number: "排序数必须是数字"
                            },
                            ManageRolesWebManage: {
                                required: "至少选择1项选择菜单"
                            }
                        },
                        submitHandler: function (form) {
                            $(form).ajaxSubmit({ url: options.url, complete: function () { modal.dialog("close"); }, success: function () {
                                $("#PageList").load(window.location.href);
                            }
                            });
                        }
                    });
                });
                return false;
            });

            $("#chooseall").click(function () {
                $("input[name='ManageRolesWebManage']").each(function (i, o) { o.checked = true });
            });
            tablelist();
        });

        function delfun(id) {
            confirmDialog(function () {
                $.ajax({
                    url: "/System/DeleteWebManageRoles",
                    data: { ids: id },
                    dataType: "json",
                    success: function (e) {
                        alertDialog("操作成功");
                        location.href = location.href;
                    }
                });
            });

        }
    </script>
</asp:Content>